from typing import *


class Solution:

    def findSmallestInteger(self, nums: List[int], value: int) -> int:
        h = [0] * value
        for n in nums:
            h[n % value] += 1
        mn = min(h)
        a = [v - mn for v in h]
        i = 0
        while i < value and a[i] != 0:
            i += 1
        return mn * value + i


so = Solution()
print(
    so.findSmallestInteger([0, 3, 2, 2, 0, 3, 3, 0, 2, 1, 1, 2, 1, 0, 1, 0, 3],
                           4))
# print(so.findSmallestInteger([3, 0, 3, 2, 4, 2, 1, 1, 0, 4], 5))
